package com.drinks.yiniang.entity.event;

import android.support.annotation.IntDef;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @author han
 * @date 2020/1/15
 */
public class OrderEvent {
    public static final int REFRESH_ALL_ORDER = 0x01;//刷新全部订单
    public static final int REFRESH_ALL_AND_WAIT_PAY_ORDER = 0x02;//刷新全部、待付款订单
    public static final int REFRESH_ALL_AND_WAIT_PAY_DELIVER_ORDER = 0x03;//刷新全部、待付款、待配送订单
    public static final int REFRESH_ALL_AND_WAIT_DELIVER_RECEIVED_ORDER = 0x04;//刷新全部、待配送、待收货订单
    public static final int REFRESH_ALL_AND_WAIT_RECEIVED_EVALUATE_ORDER = 0x05;//刷新全部、待收货、待评价订单
    public static final int REFRESH_ALL_AND_WAIT_EVALUATE_ORDER = 0x06;//刷新全部和待评价订单

    @RefreshOrderTypeDef
    private int mRefreshType;
    private int mPosition;

    @IntDef({
            REFRESH_ALL_ORDER,
            REFRESH_ALL_AND_WAIT_PAY_ORDER,
            REFRESH_ALL_AND_WAIT_PAY_DELIVER_ORDER,
            REFRESH_ALL_AND_WAIT_DELIVER_RECEIVED_ORDER,
            REFRESH_ALL_AND_WAIT_RECEIVED_EVALUATE_ORDER,
            REFRESH_ALL_AND_WAIT_EVALUATE_ORDER
    })
    @Target({
            ElementType.PARAMETER,
            ElementType.FIELD,
            ElementType.METHOD,
    }) //表示注解作用范围，参数注解，成员注解，方法注解
    @Retention(RetentionPolicy.SOURCE) //表示注解所存活的时间,在运行时,而不会存在 .class 文件中
    public @interface RefreshOrderTypeDef { //接口，定义新的注解类型
    }

    public OrderEvent(@RefreshOrderTypeDef int refreshType, int position) {
        this.mRefreshType = refreshType;
        this.mPosition = position;
    }

    public OrderEvent(@RefreshOrderTypeDef int refreshType) {
        this.mRefreshType = refreshType;
    }

    public int getRefreshType() {
        return mRefreshType;
    }

    public void setRefreshType(@RefreshOrderTypeDef int refreshType) {
        this.mRefreshType = refreshType;
    }

    public int getPosition() {
        return mPosition;
    }

    public void setPosition(int position) {
        this.mPosition = position;
    }
}
